<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
<!-- qdoc-guide.qdoc -->
  <title>Installing Clang for QDoc | QDoc Manual 5.14.2</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="../qtdoc/index.html">Qt 5.14</a></td><td ><a href="qdoc-index.html">QDoc Manual</a></td><td >Installing Clang for QDoc</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qdoc-index.html">Qt 5.14.2 Reference Documentation</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
  <link rel="prev" href="qdoc-guide.html" />
  <link rel="next" href="qdoc-guide-conf.html" />
<p class="naviNextPrevious headerNavi">
<a class="prevPage" href="qdoc-guide.html">Getting Started with QDoc</a>
<span class="naviSeparator">  &#9702;  </span>
<a class="nextPage" href="qdoc-guide-conf.html">Creating QDoc Configuration Files</a>
</p><p/>
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#set-clang-location-automatically">Set Clang location automatically</a></li>
<li class="level1"><a href="#specify-clang-location-manually">Specify Clang location manually</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Installing Clang for QDoc</h1>
<span class="subtitle"></span>
<!-- $$$qdoc-guide-clang.html-description -->
<div class="descr"> <a name="details"></a>
<p>QDoc uses Clang when parsing C++ files as well as function signatures in <a href="13-qdoc-commands-topics.html#fn-command">\fn</a> commands. Clang is part of <a href="https://llvm.org/">the LLVM Compiler Infrastructure Project</a>. Therefore, if you are going to build QDoc from source, you need to install <a href="http://clang.llvm.org">LLVM 6.0</a> or greater first. You can find the required pre-built binaries <a href="http://releases.llvm.org/download.html">here</a>.</p>
<p>To build QDoc on Debian-based Linux distributions, it is sufficient to install the <code>libclang-dev</code> package and its dependencies. For running QDoc, the <code>libclang</code> package is required.</p>
<a name="set-clang-location-automatically"></a>
<h2 id="set-clang-location-automatically">Set Clang location automatically</h2>
<p>The Qt build system uses the tool <code>llvm-config</code> to discover the location of LLVM on your system, and relies on the path to llvm-config being in the <code>PATH</code> environment variable to do so. <code>llvm-config</code> is commonly installed with LLVM and Clang on Linux systems, and also on macOS if LLVM is installed using Brew.</p>
<p>On Windows, the installation binaries provided by LLVM do not include <code>llvm-config</code>. You may still have it on your system, if you have built LLVM yourself from source. If that is the case, and you want to let the build system find Clang automatically, add the path to <code>llvm-config</code> to your <code>PATH</code> environment variable. For example:</p>
<pre class="cpp plain">

  C:\&gt; set PATH=%PATH%;C:\[build directory]\bin\Release&quot;

</pre>
<p>Make sure to set the path to your LLVM build directory. The <code>llvm-config</code> executable is located in <code>bin\Release</code> or <code>bin\Debug</code>, reflecting the build version.</p>
<a name="specify-clang-location-manually"></a>
<h2 id="specify-clang-location-manually">Specify Clang location manually</h2>
<p>If <code>llvm-config</code> is not in your <code>PATH</code> environment variable, or not installed on your system, you can still build QDoc, by manually setting the environment variable <code>LLVM_INSTALL_DIR</code> to point to the directory where the Clang libraries are installed. This directory should be the top level directory. For example, on a Linux or macOS system with LLVM installed to <code>/usr/llvm</code>:</p>
<pre class="cpp plain">

  $ export LLVM_INSTALL_DIR=/usr/llvm

</pre>
<p>Debian-based Linux distributions usually offer multiple versions of the <code>libclang</code> packages, such as <code>libclang-&lt;VERSION&gt;</code>. In this case, <code>LLVM_INSTALL_DIR</code> should contain <code>/usr/lib/clang/&lt;VERSION&gt;</code> .</p>
<p>On a Windows system with LLVM installed to <code>C:\Program Files\LLVM</code>:</p>
<pre class="cpp plain">

  C:\&gt; set LLVM_INSTALL_DIR=C:\Program Files\LLVM

</pre>
</div>
<!-- @@@qdoc-guide-clang.html -->
<p class="naviNextPrevious footerNavi">
<a class="prevPage" href="qdoc-guide.html">Getting Started with QDoc</a>
<span class="naviSeparator">  &#9702;  </span>
<a class="nextPage" href="qdoc-guide-conf.html">Creating QDoc Configuration Files</a>
</p>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2020 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
